package nullby.omnia.adapter;

import nullby.omnia.R;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Typeface;
import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class AdapterVocabulares extends CursorAdapter {

	private LayoutInflater inflater;
	private Typeface font;

	public AdapterVocabulares(Context context, Cursor c) {
		super(context, c);
		inflater = LayoutInflater.from(context);
		font = Typeface.createFromAsset(context.getAssets(), "font.ttf");
	}

	@Override
	public void bindView(View view, Context context, Cursor cursor) {
		TextView tvNapravlenie = (TextView) view
				.findViewById(R.id.tvNapravlenie);
		TextView tvFormat = (TextView) view.findViewById(R.id.tvFormat);
		TextView tvCount = (TextView) view.findViewById(R.id.tvCount);
		TextView tvPath = (TextView) view.findViewById(R.id.tvPath);

		tvNapravlenie.setText(cursor.getString(1));
		tvFormat.setText(cursor.getString(1));
		tvCount.setText(cursor.getString(1));
		tvPath.setText(cursor.getString(1));

		tvNapravlenie.setTypeface(font);
		tvFormat.setTypeface(font);
		tvCount.setTypeface(font);
		tvPath.setTypeface(font);
	}

	@Override
	public View newView(Context context, Cursor cursor, ViewGroup parent) {
		return inflater.inflate(R.layout.item_vocabulare, parent, false);
	}

}
